package com.example.szh.mvp.model;

import com.example.szh.Api;
import com.example.szh.entity.BaseEntity;
import com.example.szh.entity.TokenEntity;
import com.example.szh.http.HttpFactory;
import com.example.szh.http.HttpType;
import com.example.szh.mvp.contract.SplashContract;
import com.example.szh.nextwork.ChangeFunction;
import com.example.szh.nextwork.model.BaseModel;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;

public class SplashModel extends BaseModel implements SplashContract.ISplashIModel {
    @Inject
    public SplashModel(){}
    @Override
    public Observable<BaseEntity> requestToken(Map<String, Object> map) {
        Observable<TokenEntity>ob= HttpFactory.getInstance().factory(HttpType.SIGNTYPE)
                .getRetrofit().create(Api.class).requestToken(createBody(map));
        return ob.map(new ChangeFunction<TokenEntity>());
    }
}
